<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script>
		/* var sum=0;
		 for (var i=1; i<101;i++){
		  if (i%2==1){
			console.log(i);//语句
			sum+=i;  //语句
		  } 
		 }
		 console.log(sum); */
		var num = '';
		console.time('text');//计时器
        var sum=0;
		var num = prompt('请输入数字');
		for (var i = 2; i < num; i++) {
			if (num % i == 0) {
			sum++;
			}
		}
		if (sum==0){
			alert(num + '是一个质数');
		}else 
		{
			alert(num + '不是一个质数');
		}
		//console.log(sum); Math.sqrt(sum);给sum开方；
	</script>
</body>
</html>